package com.retailcloud.inventoryservice.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.retailcloud.commonutils.utils.PageUtils;
import com.retailcloud.commonutils.utils.R;
import com.retailcloud.inventoryservice.entity.InventoryLogEntity;
import com.retailcloud.inventoryservice.service.InventoryLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;





/**
 * 库存变动记录表
 *
 * @author wudi
 * @email 632132852@qq.com
 * @date 2024-11-05 21:41:03
 */
@RestController
@RequestMapping("/inventorylog")
public class InventoryLogController {
    @Autowired
    private InventoryLogService inventoryLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions(":inventorylog:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = inventoryLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions(":inventorylog:info")
    public R info(@PathVariable("id") String id){
		InventoryLogEntity inventoryLog = inventoryLogService.getById(id);

        return R.ok().put("inventoryLog", inventoryLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions(":inventorylog:save")
    public R save(@RequestBody InventoryLogEntity inventoryLog){
		inventoryLogService.save(inventoryLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions(":inventorylog:update")
    public R update(@RequestBody InventoryLogEntity inventoryLog){
		inventoryLogService.updateById(inventoryLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions(":inventorylog:delete")
    public R delete(@RequestBody String[] ids){
		inventoryLogService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
